package com.example.parttimejob.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.parttimejob.pojo.entity.Merchants;
import com.example.parttimejob.pojo.entity.dto.MerchantsDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface StoreMapper extends BaseMapper<Merchants> {
    //根据用户名查询密码
    @Select("select * from part_time_job.merchants where merchant_username=#{merchantUsername}")
    Merchants selectBymerchantUsername(String merchantUsername);
    //注册
    @Insert("insert into part_time_job.merchants(merchant_username,passwd,account_status) values (#{merchantUsername},#{passwd},#{status})")
    void registStore(String merchantUsername, String passwd,String status);

    //判断商家是否实名
    @Select("select account_status from part_time_job.merchants where merchant_id=#{merchantId}")
    String selectStoreStatus(Integer merchantId);

    //根据id查询商户所有信息
    @Select("select * from part_time_job.merchants where merchant_id=#{id}")
    Merchants getById(Integer id);

    //根据id查询密码
    @Select("select passwd from part_time_job.merchants where merchant_id=#{merchantId}")
    String selectPasswdById(Integer merchantId);


    //根据id查询商铺名称
    @Select("select merchant_name from part_time_job.merchants where merchant_id=#{targetId}")
    String selectRealByMerchantId(Integer targetId);
}
